What does the following error mean? |
Re: Null module do loop perameter Check your code to make sure it is getting the Module/Baseline handles properly. AAI Services, Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com |
Re: Null module do loop perameter >Louie |
Re: Null module do loop perameter llandale - Fri Mar 27 10:38:38 EDT 2009 The exact error I get is below. I still don't know what triggers the error, some baselines work fine, others don't. -R-E- DXL: <Line:134> null Module do loop parameter was passed Backtrace: <Line:530> <Line:572> <Line:602> |
Re: Null module do loop perameter the@dmin - Fri Mar 27 12:38:25 EDT 2009 At line 444 you use a 'suffix' variable, but that's a built in perm. I see it declared above and given value null, I wonder if that's really what you want. Don't you want to derive the ACTUAL baseline suffix from 'selectedBaseline'? Also at line 444 you get a 'baseline' handle, then check to see if it exists. This isn't going to work since the 'baseline' command always returns a handle based on the criteria, it has nothing to do with whether that baseline exists in the current module. Thus you never get the halt following it. I think you should move the halt code below the 'load' statement, halt if moduleToLinkTo is null. As it is, its possible that the moduleToLinkTo is in fact null which might trigger your problem. When combined with my 'suffix' comment above, it appears you are failing to get a basline handle of the actual baseline, when that baseline has a suffix. This looks like your problem. Your 'majorExp' regexp doesn't seem to care about the Suffix. Also.... Golly, what lousy indendation. Very hard to read. I wonder what will happen to your Regular expression 'modVer' at line 397 if the Suffix has a TAB in it... It doesn't matter much, but your constant Regular Expressions should be defined globally even when only one function uses it, since the 'regexp' command takes an enourmous amount of time to execute; certainly much longer than it takes to use it. I notice you define Skip variable moduleBaselines globally, and also define it local to function linkDoCreateLinks(). You do not delete this Skip list. At line 198 you should not just check for null Module result, but if needed make sure its actually open for Edit; since the 'edit' command can indeed open the module for read (depending on a user response). Is it possible that your 'trg_name' and 'src_Name' variables are read from your dialog box as unqualified names e.g. "MyModule", instead of full path names e.g. "/MyProject/MyFolder/MyModule"? If so, I suppose its possible the 'module' commands work based on the current folder, but subsequent 'read' or 'edit' commands don't work. >Louie |
Re: Null module do loop perameter llandale - Mon Mar 30 13:31:32 EDT 2009 Thanks for the detailed analysis, it will help me get further that I would have on my own! Corey |
Re: Null module do loop perameter the@dmin - Mon Mar 30 15:36:11 EDT 2009 Not your fault, but this is one of worst pieces of code I've ever seen. Variables used for more than one purpose, multiple variables with the same purpose, global variables declared but not used, local variables with the same name as global variables, in one case defined within a function AFTER using the global variable with the same name, hokey variable names, embedded functions, return paramaters that are global variables, no comments of course, indentation out of whack and inconsistent, lots of code that contributes nothing, modifying modules with no 'save' command, opening modules with no 'close' commands, creating data structures with no 'delete' command, bla bla bla. Understand that the "Baseline" variable stuff is confusing. If you use the "for bl in mod" loop you get an actual Baseline handle you can query, such as its date. Getting a Baseline handle in any other way, such as at line 444 "Baseline bl = baseline(maj, min, suffix)", returns a theoretical Baseline handle that may or may not exist, but that you cannot query even if it DOES exist. They should have used two data types for these two different notions, the second one perhaps "BaselineRef"; oh well. Recent practicing with Regexp reveals that if the Regexp can match more than one sequence in the string, it will match the LAST one, not the FIRST one. In this case if the Annotation contains a TAB character, the "modver" regexp match at line 421 will match inside the Annotation; throwing the rest of that code into the Abyss. Code below demonstrates the validity of two new regular expressions I wrote, versionWithSuffix and versionWithoutSuffix, based on well formed "moduleBaseline" string as created at line 364, adding tabs to the annotation. I note with curiosity the space before the second \t at line 364; that's in the regexp. Notice these two regular expressions start with "^", meaning "at the start of the string", just in case your Annotation contains something that looks like a baseline "3.2", followed by tabs. Notice they also look for "one or more digits" "+", rather than "zero or more characters", ".". >>I think you can skip the two "modVer" checks at lines 413 and 421. >>Use the two regular expressions below on the original string; there are oddly several variables with that value, "selectedBl" will do. If the with-suffix match works set the "maj", "min" and suffix, otherwise if the without-suffix match works set maj min and suffix="", otherwise you have an error. >>Before (current) line 450, add a check for "baselineExists(trg_mod, bl)" >>After (current) line 450, check for null "moduleToLinkTo". Good luck. Regexp versionWithSuffix = regexp "^([0-9]+)\\.([0-9]+)\\((.+)\\)(\t.+)( \t.+)"if (versionWithSuffix moduleBaseline2){ print "2 YES Suffix: ^" moduleBaseline2[match 1] "^\t*" moduleBaseline2[match 2] "*\t" print "#" moduleBaseline2[match 3] "#\t^" moduleBaseline2[match 4] "^\n" } else print "2 No Yes suffix match\n" if (versionWithoutSuffix moduleBaseline2) { print "2 NOT Suffix: ^" moduleBaseline2[match 1] "^\t*" moduleBaseline2[match 2] "*\t" print "#" moduleBaseline2[match 3] "#\t^" moduleBaseline2[match 4] "^\n" } else print "2 No Not suffix match\n" |